# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=gmic
pkgver=3.3.5
pkgrel=0
pkgdesc="GREYC's Magic for Image Computing"
url="https://gmic.eu/"
# s390x: gimp
arch="all !s390x"
license="CECILL-2.1"
makedepends="
	bash
	curl-dev
	eigen-dev
	fftw-dev
	gimp-dev
	graphicsmagick-dev
	openexr-dev
	qt5-qtbase-dev
	tiff-dev
	"
subpackages="
	$pkgname-bash-completion
	$pkgname-doc
	$pkgname-dev
	$pkgname-libs
	$pkgname-qt
	gimp-plugin-gmic:gimp
	"
source="https://gmic.eu/files/source/gmic_$pkgver.tar.gz
	notune.patch
	rpath.patch
	"
options="!check" # No test suite

build() {
	export CFLAGS="$CFLAGS $LDFLAGS"
	make lib
	make cli_shared
	make gimp_shared
	make gmic_qt_shared
}

package() {
	make DESTDIR="$pkgdir" PREFIX="/usr" install
	install -Dm644 resources/gmic_cluts.gmz -t "$pkgdir"/usr/share/gmic
}

qt() {
	pkgdesc="GMIC qt ui"

	amove usr/bin/gmic_qt \
		usr/share/applications \
		usr/share/icons
}

gimp() {
	pkgdesc="GMIC gimp plugin"
	install_if="$pkgname=$pkgver-r$pkgrel gimp"

	amove usr/lib/gimp
}

sha512sums="
bf8f6cc171014c16bc15effa10e7e7dfba95de6a8ccb35edb064f05b838fda59d7922bee8d484d8219f06dec8e83d0734a05acaf7ccd72aad667441bfea3218e  gmic_3.3.5.tar.gz
663773af7c6cd7a06d9bc84972dea60d40b0d2eb6fb9f5aef2da482ebf9ed8218f82f998f4e1846051365307a6740308e793abcc60d34f534e40080d0710c7bf  notune.patch
e9184cac37360d1da22b996c2e44b25ad26ae64d64c114b792b0a83c4383ebd1a698e8dc40f8d003334ed8a45b32b01e32413a14b8ed8976569fd9dc00359bb2  rpath.patch
"
